<!--#include file="common/header.html"-->
<body>
    <div class="container-fluid larry-wrapper">
        <div class="row">
            <div class="col-xs-12 col-sm-12 col-md-12">
                <!--头部搜索-->
                <section class="panel panel-padding">
                    <form class="layui-form" action="/education/admin/freightTemplate">
                        <div class="layui-form">
                            <div class="layui-inline">
                                <div class="layui-input-inline">
                                    <input class="layui-input" name="_query.keyword" placeholder="关键字">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <button lay-submit class="layui-btn" lay-filter="search">查找</button>
                            </div>
                        </div>
                    </form>
                </section>

                <!--列表-->
                <section class="panel panel-padding">
                    <div class="group-button">
                        <button class="layui-btn layui-btn-small modal-catch" beforeFun="beforeAdd"
                                data-params='{"content":".add-subcat", "title":"添加","type":"1", "area":"600px,auto", "maxmin":"true"}'>
                            <i class="iconfont">&#xe649;</i> 添加
                        </button>
                        <!--<button class="layui-btn layui-btn-small" onclick="viewDetail();">
                            <i class="iconfont">&#xe653;</i>编辑
                        </button>-->
                        <button class="layui-btn layui-btn-small layui-btn-danger ajax-all" data-name="checkbox" data-params='{"url": "/education/admin/freightTemplate/delete"}'>
                            <i class="iconfont">&#xe626;</i> 删除
                        </button>
                    </div>
                    <div id="list" class="layui-form"></div>

                    <div class="text-right" id="page"></div>
                </section>
            </div>
        </div>
    </div>
    <div class="add-subcat">
        <form class="layui-form layui-form-pane" action="/education/admin/freightTemplate/save" id="form1">
            <input type="hidden" name="a.id">
            <input type="hidden" name="a.is_special_free" value="0">

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 150px;">模板名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="a.template_name" required jq-verify="required"  class="layui-input ">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 150px;">是否包邮</label>
                <div class="layui-input-block">
                    <input type="radio" name="a.is_free" title="否" value="0" checked />
                    <input type="radio" name="a.is_free" title="是" value="1" />
                </div>
            </div>

            <input type="hidden" name="a.cal_type" value="2">
            <!--<div class="layui-form-item">
                           <label class="layui-form-label" style="width: 150px;">计价方式</label>
                           <div class="layui-input-block">
                               <input type="radio" name="a.cal_type" title="按件" value="1" />
                               <input type="radio" name="a.cal_type" title="按重量" value="2" checked />
                           </div>
                       </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label" style="width: 150px;">设置为默认模板</label>
                <div class="layui-input-block">
                    <input type="radio" name="a.is_default" title="否" value="0" checked />
                    <input type="radio" name="a.is_default" title="是" value="1" />
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" jq-submit jq-filter="submit">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>


</body>
<!--#include file="freightTemplate-list.html"-->
<script src="../js/layui/layui.js"></script>
<script type="text/javascript" src="../js/lib/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="../js/lib/rest.js"></script>
<!--#include file="common/version.html"-->
<script>
    layui.use('user_list');

    function beforeAdd(obj){
        $('#form1').attr('action', '/education/admin/freightTemplate/save');
    }

    function viewDetail(ids){
        var index = layer.open({
            type: 1,
            title:'编辑',
            area:'600px',
            content: $('.add-subcat')
        });
        // layer.full(index);
        $('#form1').attr('action', '/education/admin/freightTemplate/update/' + ids);
        restGet('/education/admin/freightTemplate/view/' + ids, null, $('#form1'), function(rs){
        })
    }

    function setRule(ids,name){
        var index = layer.open({
            type: 2,
            content: "freightRule.html?ids=" + ids, "title": '【'+ name +'】' + '规则设置', "area": ['500px', '600px'],
            "maxmin":"true"
        });
        layer.full(index);
    }
</script>

</html>